package com.nulldev.util.java.swing.extSwing.resources;

import java.awt.Color;
import java.awt.image.BufferedImage;
import java.io.IOException;

import javax.imageio.ImageIO;

import com.nulldev.util.image.ImageUtil;

public class extSwingResourceManager {

	private static BufferedImage music, music_16, music_32, music_32e, discord, discord32e;
	
	public static BufferedImage getMusic() {
		if (music == null) {
			try {
				music = ImageIO.read(extSwingResourceManager.class.getResource("music_icon.png"));
			} catch (IOException e) {
				e.printStackTrace();
			}
		}
		return music;
	}
	
//	public static BufferedImage getDiscord() {
//		if (discord == null) {
//			try {
//				discord = ImageIO.read(extSwingResourceManager.class.getResource("discord-logo.png"));
//			} catch (IOException e) {
//				e.printStackTrace();
//			}
//		}
//		return discord;
//	}
//	
//	public static BufferedImage getDiscord32W(final Color color) {
//		if (color == Color.WHITE) {
//			return getDiscord32W();
//		}
//		return ImageUtil.B2A(ImageUtil.scale(getDiscord(), 16, 16), color);
//	}
//	
//	public static BufferedImage getDiscord32W() {
//		if (discord32e == null) {
//			try {
//				discord32e = ImageUtil.B2W(ImageUtil.scale(getDiscord(), 16, 16));
//			} catch (Exception e) {
//				e.printStackTrace();
//			}
//		}
//		return discord32e;
//	}
	
	public static BufferedImage getMusic16() {
		if (music_16 == null) {
			try {
				music_16 = ImageUtil.scale(getMusic(), 16, 16);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return music_16;
	}
	
	public static BufferedImage getMusic32() {
		if (music_32 == null) {
			try {
				music_32 = ImageUtil.scale(getMusic(), 16, 16);
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return music_32;
	}
	
	public static BufferedImage getMusic32W() {
		if (music_32e == null) {
			try {
				music_32e = ImageUtil.B2W(ImageUtil.scale(getMusic(), 16, 16));
			} catch (Exception e) {
				e.printStackTrace();
			}
		}
		return music_32e;
	}
	
	public static BufferedImage getMusic32W(final Color color) {
		if (color == Color.WHITE) {
			return getMusic32W();
		}
		return ImageUtil.B2A(ImageUtil.scale(getMusic(), 16, 16), color);
	}
}
